Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove the default variant style, fix type issue #97

Merged
merged 1 commit into from
Aug 21, 2019

Conversation

ajdaniel
Copy link
Contributor

Fixes #87 which was caused by #85

There were typing issues with the TextField as it was extending the Mui TextFieldProps type, which caused a problem with the varient type, which is a Union of several types.

To fix this, I hard coded it. This may not be the right way, so I'm happy to take feedback.

But in the end, this removes the hard-coded variant of standard

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 79.231% when pulling 2ca3b12 on ajdaniel:master into f4f55d0 on stackworx:master.

@cliedeman cliedeman merged commit 41820fb into stackworx:master Aug 21, 2019
@cliedeman
Copy link
Collaborator

Thanks you, I find autocomplete still does not work but this still solves a real issue

@ajdaniel
Copy link
Contributor Author

What is your autocomplete issue?

@cliedeman
Copy link
Collaborator

Editing

          <Field
            type="password"
            label="Password"
            name="password"
            variant="standard"
            component={TextField}
          />

does not provide auto complete for types.
Try editing any of the fields in TextField.story.tsx.

Granted I'm not sure if I ever got this to work

@ajdaniel
Copy link
Contributor Author

Have you tried using the autocomplete attribute? https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

When I use this library for my login form, the autocomplete from my browser/password manager copes fine, when I use autocomplete="password" etc

@cliedeman
Copy link
Collaborator

cliedeman commented Aug 21, 2019

I mean IDE autocompletion or intellisense

@ajdaniel
Copy link
Contributor Author

Oh I see, my mistake. The interface for Mui Text Field has this:

interface BaseTextFieldProps {
  type?: string;
}

So the prop name type should autocomplete (I see this in my editor) but none of the values. You'd have to extend the interface to have some suggestions, like:

interface BaseTextFieldProps {
  type?: 'text' | 'password' | 'email' | undefined;
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TextField from this package overrides global variant prop
3 participants